package com.hanrui.android.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hanrui.android.R;
import com.hanrui.android.model.PerformanceDetailBean;

import javax.inject.Inject;

/**
 * Created by Administrator on 2018/2/9.
 */

public class PerformDetailAdapter extends BaseQuickAdapter<PerformanceDetailBean.PerformanceListBean,BaseViewHolder> {

    String project = "";

    @Inject
    public PerformDetailAdapter(){
        super(R.layout.item_performance);
    }

    @Override
    protected void convert(BaseViewHolder helper, PerformanceDetailBean.PerformanceListBean item) {

        if (!project.equals(item.getProjectContent())) {

            helper.setGone(R.id.min_title,true);

        }else {

            helper.setGone(R.id.min_title,false);

        }

        project = item.getProjectContent();
        helper.setText(R.id.min_title,item.getProjectContent());
        switch (item.getQuarter()) {
            case "1":
                helper.setText(R.id.work_contenttitle,"第一季度计划目标")
                        .setText(R.id.carry_title,"第一季度完成情况");
                break;
            case "2":
                helper.setText(R.id.work_contenttitle,"第二季度计划目标")
                        .setText(R.id.carry_title,"第二季度完成情况");
                break;
            case "3":
                helper.setText(R.id.work_contenttitle,"第三季度计划目标")
                        .setText(R.id.carry_title,"第三季度完成情况");
                break;
            case "4":
                helper.setText(R.id.work_contenttitle,"第四季度计划目标")
                        .setText(R.id.carry_title,"第四季度完成情况");
                break;
        		}

        helper.setText(R.id.name,item.getYearTarget()).setText(R.id.work_content,item.getQuarterTarget())
                .setText(R.id.carry,item.getQuarterCompletion())
                .setText(R.id.check,item.getRules())
                .setText(R.id.base_score,String.valueOf(item.getBaseScore()))
                .setText(R.id.self_score,String.valueOf(item.getSelfScore()));


    }
}